package com.huawei.appmarket.service.store.awk.card;

import android.content.Context;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.ImageView;
import android.widget.TextView;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appgallery.horizontalcard.api.card.BaseHorizontalItemCard;
import o.azb;
import o.cgz;
import o.chc;
import o.chy;
import o.ehz;
import o.eqx;
import o.evx;
import o.ewm.d;
import o.ewm.e;
import o.ewm.h;
import o.ewm.j;

public class MaterialRelatedItemCard extends BaseHorizontalItemCard {
    private ImageView ʻ;
    private ImageView ʽ;
    private TextView ˋ;
    private View ॱॱ;

    public MaterialRelatedItemCard(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        this.ʻ = (ImageView) view.findViewById(j.י);
        this.ॱॱ = view.findViewById(j.ߴ);
        this.ˋ = (TextView) view.findViewById(j.ʽ);
        this.ʽ = (ImageView) view.findViewById(j.ˉﾞ);
        ʽ(view);
        ॱॱ();
        return this;
    }

    private void ॱॱ() {
        int ʼ = ʼ();
        ʼ = ((azb.ॱ(this.ʼॱ) - (this.ʼॱ.getResources().getDimensionPixelSize(d.ᐨ) * (ʼ - 1))) - (this.ʼॱ.getResources().getDimensionPixelSize(d.ᐝˊ) * 2)) / ʼ;
        int i = ʼ / 2;
        LayoutParams layoutParams = this.ॱॱ.getLayoutParams();
        if (layoutParams != null) {
            layoutParams.width = ʼ;
            layoutParams.height = i;
            this.ॱॱ.setLayoutParams(layoutParams);
            LayoutParams layoutParams2 = this.ˋ.getLayoutParams();
            if (layoutParams2 != null) {
                layoutParams2.width = ʼ;
                this.ˋ.setLayoutParams(layoutParams2);
            }
        }
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        if (cardBean instanceof ehz) {
            ehz o_ehz = (ehz) cardBean;
            eqx.ˏ(this.ʻ, o_ehz.ʻᐝ(), "image_default_icon");
            this.ˋ.setText(o_ehz.ʾॱ());
            if (o_ehz.ʼᐝ() == 3) {
                this.ʽ.setImageResource(e.ͺॱ);
                this.ʽ.setVisibility(0);
            } else if (o_ehz.ʼᐝ() == 7) {
                this.ʽ.setImageResource(e.ˋˋ);
                this.ʽ.setVisibility(0);
            } else {
                this.ʽ.setVisibility(8);
            }
        }
    }

    public void ॱ(final chy o_chy) {
        OnClickListener anonymousClass3 = new evx(this) {
            final /* synthetic */ MaterialRelatedItemCard ॱ;

            public void ˋ(View view) {
                o_chy.ˏ(0, this.ॱ);
            }
        };
        ˉ().setOnClickListener(anonymousClass3);
        this.ʻ.setOnClickListener(anonymousClass3);
    }

    public int ʼ() {
        return chc.ʽ();
    }

    public int ˊ() {
        return h.ˎـ;
    }

    public int ˎ() {
        return h.ˎـ;
    }

    public int ᐝ() {
        if (this.ॱॱ == null || this.ॱॱ.getLayoutParams() == null) {
            return 0;
        }
        return this.ॱॱ.getLayoutParams().height;
    }
}
